package com.zsh.fmmall.controller;

import com.zsh.fmmall.util.Base64Utils;
import com.zsh.fmmall.vo.BaseCode;
import com.zsh.fmmall.vo.ResultVO;
import io.jsonwebtoken.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/shopCart")
@Api(value = "提供购物车业务相关接口",tags = "购物车管理")
@CrossOrigin//利用后端注解的方式解决跨域请求
public class ShopCartController {

    @ApiOperation("购物车列表接⼝")
    @ApiImplicitParam(dataType = "string",name = "token", value = "授权令牌",required =true)
    @GetMapping("/list")
    public ResultVO listCarts(String token){

            return new ResultVO(BaseCode.ok,"success",null);

//        System.out.println("购物车列表接⼝————————————");
      /*  if(token==null){
            return new  ResultVO(BaseCode.no,"请先登录",null);
        }else {
            String decode = Base64Utils.decode(token);
            if(decode.endsWith("zsh0413")){
                return new  ResultVO(BaseCode.ok,"sucess测试成功",null);
            }else{
                return new  ResultVO(BaseCode.no,"登录过期，请重新登录！！",null);
            }
        }*/

    }
}
